<script src="jquery.js"></script>
<script>
	function sessionVariable(){
		if(typeof(Storage)!=="undefined")
		{
			sessionStorage.setItem("username",$("#login_username").val());
		}
		else
		{
			$("#loginformContent").html("Sorry.Your Browser Doesn't Support Web Storage");
		}
	}
	$(function(){
		$("#login_button").click(function(){
			$.post("signin.php?seed="+Math.random(),{
				user:$("#login_username").val(),
				pwd:$("#login_password").val()
			},function(data){
				if($.trim(data)=="admin")
				{
					window.location.href = "http://localhost/test/miniproject/frontend/admin.html";
					sessionVariable();
					
				}
				else if($.trim(data)=="student")
				{
					window.location.href="http://localhost/test/miniproject/frontend/student.html";
					sessionVariable();
				}
				else
				{
					$("#login_result").text("Sorry.Wrong Username or Password");
				}
			});
		});
	});
</script>
<section id="loginformContent">
	Username<input type="username" id="login_username"/>
	Password<input type="password" id="login_password"/><br/>
	<label id="login_result" class="resultlabel"></label><br/>
	<button type="button" id="login_button">Signin</button>
</section>
